import Cookies from 'js-cookie'
const TokenKey = 'guiplan'
import Md5 from '../libs/md5'
let gToken = () => {
  const token = Cookies.get(TokenKey)
  if (token) return token
  else return false
}
let sToken = (token) => {
  Cookies.set(TokenKey, token, { expires: 1 })
}

export function getToken() {
  // return Cookies.get(TokenKey) 
  return gToken() // 这里的token统一用libs里的
}

export function setToken(token) {
	return sToken(token)
  // return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function setPassword(value){ // 设置密码
	return Md5(value + 'guiplanAuth')
}